
task CheckPurityRate
{
let ItemCheck=0;//ʃf[^̔z̒`FbNϐ
let XY=[];//ʃf[^̏ɃNbVu߂̕ϐ
//let ItemPerFrame=60;//Pt[̍őACei΍j
loop
{
	ItemCheck=length(GetCommonDataDefault("PurityRateArray",[]));//t[ʃf[^̒`FbN
	if(ItemCheck>0)
	{//zɒgiACetOĂjꍇ̏
		loop
		{
			XY=GetCommonDataDefault("PurityRateArray",[]);//ʃf[^eϐɓn

			PurityRateChange(XY[0]);

			XY=erase(XY, 0);

			if(length(XY)==0)
			{//폜̔z񂪋ɂȂꍇ
				SetCommonData("PurityRateArray",[]);//ʃf[^ɂ
				break;//ACe[vEo
			}
			else
			{
				SetCommonData("PurityRateArray",XY);
			}//z񂪋łȂꍇʃf[^ɕύX̔zn
		}
	}
yield;
}
}

task PurityRateChange(Rate)
{
	if(PurityRate<=Rate && Rate>1)
	{
		if(PurityRateCount<30)
		{
		PurityRateCount=30;
		}
		PurityRate=Rate;
	}
}

task PurityRateDifine
{
loop
{
	if(PurityRateCount==0)
	{
		PurityRate=1;
	}
	PurityRateCount-=1;
	if(OnBomb)
	{
		PurityRateCount-=1;
	}
	if(PurityRateCount<0){PurityRateCount=0;}
yield;
}
}


task BombCheck
{
loop
{
	if(OnBomb)
	{
		if(SectionMagicFragment>0)
		{
			SectionMagicFragment-=floor(SectionMagicFragment/5000)+1;

			if(BurstMode==1)
			{
				SectionMagicFragment-=floor(SectionMagicFragment/5000)+1;
			}
			if(SectionMagicFragment<0){SectionMagicFragment=0;}
		}
		BurstRank-=8;
		if(BurstRank<0){BurstRank=0;}
		if(OnHiSpeedBomb)
		{
			PNRate+=0.2;
			if(PNRate>100){PNRate=100;}
		}
		else if(OnLowSpeedBomb)
		{
			PNRate-=0.2;
			if(PNRate<-100){PNRate=-100;}
		}
		else
		{
		if(PNRate<0)
		{
			PNRate+=0.2;
			if(PNRate>0){PNRate=0;}
		}
		else
		{
			PNRate-=0.2;
			if(PNRate<0){PNRate=0;}
		}
		}

	//	if(RushGauge>0){RushGauge-=1;}
	//	else{RushGauge+=1;}
	}
yield;
}
}

task SlowKeyCheck
{
RushGaugeChangeByShot;
wait(30);
if(GetCommonDataDefault("SELECTEDDIFFICULT","None")!="Extream"){return;}
let count=0;
loop
{
	if(GetKeyState(VK_SLOWMOVE)!=KEY_FREE)
	{
		count=15;
	}
	if(count>0)
	{
	count-=1;
	}
	if(count>0)
	{
		SetCommonData("SlowMoveSwitch",true);
	}
	else
	{
		SetCommonData("SlowMoveSwitch",false);
	}
yield;
}

}

task RushGaugeChangeByShot
{
wait(3);
if(GetCommonDataDefault("SELECTEDDIFFICULT","None")!="Extream"){return;}
let count=0;
let Pcount=-30;
let Ncount=-30;
let Neutralcount=-30;
loop
{
	if(shotCount>=0 && !BurstMode)
	{
		if(GetCommonDataDefault("SlowMoveSwitch",true))
		{
			Neutralcount=-30;
			Pcount=-30;
			if(Ncount<60)
			{
			Ncount+=1;
			}
			if(Ncount>0)
			{
			PNRate-=Ncount/600;
			if(PNRate<-100){PNRate=-100;}
			if(absolute(RushGauge)!=1000)
			{
			RushGauge-=Ncount/60/4;
			if(RushGauge<-1000){RushGauge=-1000;}
			}
			}
		}
		else
		{
			Neutralcount=-30;
			Ncount=-30;
			if(Pcount<60)
			{
			Pcount+=1;
			}
			if(Pcount>0)
			{
			PNRate+=Pcount/600;
			if(PNRate>100){PNRate=100;}
			if(absolute(RushGauge)!=1000)
			{
			RushGauge+=Pcount/60/4;
			if(RushGauge>1000){RushGauge=1000;}
			}
			}
		}
	}
	else if(!BurstMode)
	{
		Pcount=-30;
		Ncount=-30;
		if(Neutralcount<60)
		{
			Neutralcount+=1;
		}
		if(Neutralcount>0)
		{
		if(PNRate<0)
		{
			PNRate+=Neutralcount/600;
			if(PNRate>0){PNRate=0;}
		}
		else
		{
			PNRate-=Neutralcount/600;
			if(PNRate<0){PNRate=0;}
		}
		}
		
	}
yield;
}

}

let MainShotCreateItemJudg=0;

function MainShotHit(x,y)
{
	if(GetCommonDataDefault("SELECTEDDIFFICULT","None")=="Arrange"){return;}
	if(MainShotCreateItemJudg<6)
	{
		MainShotCreateItemJudg+=1;
		return;
	}
	else
	{
		MainShotCreateItemJudg=0;
	}
	let PowerPlus;
	let CounterPlus;
	let CounterPlusOnBurst;
	let ScorePlus;
	let FragmentPlus=1;

	if(BurstMode==1)
	{
		PowerPlus=0.5;
		CounterPlus=5;
		CounterPlusOnBurst=5;
		ScorePlus=MagicCounter*10;
		FragmentPlus=1;
	}
	else
	{
		PowerPlus=0.5;
		CounterPlus=5;
		CounterPlusOnBurst=5;
		ScorePlus=MagicCounter;
		FragmentPlus=1;
	}

	if(Power<1000 && BurstMode==0)
	{
		Power+=PowerPlus;
		if(Power>1000){Power=1000;}
	}
	if(MagicCounter<10000 && BurstMode==0)
	{
		MagicCounter+=CounterPlus;
		if(MagicCounter>10000){MagicCounter=10000;}
	}
	if(MagicCounter<10000 && BurstMode==1)
	{
		MagicCounter+=CounterPlusOnBurst;
		if(MagicCounter>10000){MagicCounter=10000;}
	}

	AddScore(ScorePlus);
	MagicFragment+=FragmentPlus;
	SectionMagicFragment+=FragmentPlus;
	//PlaySE("se\seScore.wav");
}

task CreateMigicItem(x,y,type)
{
		if(type==-1)
		{
			Weakness;
			return;
		}

		if(WeaknessCount>0 && type!=-1){return;}
		let DifficultChargeAmp=1;
		let DifficultCounterAmp=1;
		let DifficultScoreAmp=1;
		let DifficultFragmentAmp=1;

		let obj=Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj, imgItemStar);
		ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj, ADD); 
		ObjEffect_CreateVertex(obj, 4);
		let AnimeNumCount=rand_int(0,14);
		let AnimeNum=0;

		ObjEffect_SetVertexXY(obj, 0, -52/2, -40/2);
		ObjEffect_SetVertexXY(obj, 1, 52/2,  -40/2);
		ObjEffect_SetVertexXY(obj, 2, 52/2, 40/2);
		ObjEffect_SetVertexXY(obj, 3,  -52/2,  40/2);

		ObjEffect_SetVertexUV(obj, 0,  0,  0+80*AnimeNum);
		ObjEffect_SetVertexUV(obj, 1,  104, 0+80*AnimeNum);
		ObjEffect_SetVertexUV(obj, 2, 104,  80+80*AnimeNum);
		ObjEffect_SetVertexUV(obj, 3, 0, 80+80*AnimeNum);

			ascent(let i in 0..4)
			{
				ObjEffect_SetVertexColor(obj,i,155,255,255,255);
			}	

		ObjEffect_SetLayer(obj,3);
		Obj_SetPosition(obj,x,y);
		let StandardSpeed=rand(3,10);
		let angle=atan2(GetPlayerY-y,GetPlayerX-x)+180+rand(-150,150);
		if(type==4 || type==41 || type==42 || type==6 || type==61 || type==62)
		{
			StandardSpeed*=1.5;
		}
		if(type==4 || type==41 || type==42 || type==6 || type==61 || type==62)
		{
			StandardSpeed=rand(3,15);
		}
		let speed=StandardSpeed;
		let lightangle=rand(0,360);
		let ZAngle=0;
		let ZRotateAngle=rand(-15,15);
		let ZRotateAngle=0;
		let Scale;
		let DiScale;
		let R;
		let G;
		let B;
		let Alpha=100;
		let VAlpha=25;

		let Alpha=50;
		let VAlpha=25;

		let PowerPlus;
		let CounterPlus;
		let CounterPlusOnBurst;
		let ScorePlus;
		let FragmentPlus=1;
		let RushGaugePlus=0;
		let amp=1;
		let BurstRankPlus=0;
		let PurityRatePlus=0.5;

		let PNRatePlus=0;

		let RushGaugeAdjustPower=1;
		let RushGaugeAdjustMagic=1;
		let RushGaugeAdjustScore=1;
		let RushGaugeAdjustFragment=1;
		let RushGaugeAdjustRankUp=1;
		let RushGaugeAdjustRankDown=1;

		let RushGaugeChange=0;
		let PNRateChange=0;
		if(GetCommonDataDefault("SELECTEDDIFFICULT","None")=="Extream")
		{
			if(RushGauge>=0)
			{
				RushGaugeAdjustRankUp=1+0.25*RushGauge/1000;
			}
			else
			{
				RushGaugeAdjustRankDown=1-0.25*RushGauge/1000;
			}
		}
		
		if(type==1)//΃ACe@ߐڌjɏo
		{
			Scale=1.5;
			DiScale=0.015;
			R=127;
			G=255;
			B=127;
			PowerPlus=1;
			CounterPlus=6;
			CounterPlusOnBurst=4;
			ScorePlus=2*MagicCounter;
			BurstRankPlus=0;
			FragmentPlus=1*1;
			RushGaugeChange=0.5;
			PurityRatePlus=0.75;
		}
		if(type==1.5)//΃ACe@ߐڌjɏo
		{
			Scale=2.0;
			DiScale=0.02;
			R=127;
			G=255;
			B=127;
			PowerPlus=1*2;
			CounterPlus=6*2;
			CounterPlusOnBurst=4*2;
			ScorePlus=2*MagicCounter*2;
			BurstRankPlus=0*2;
			FragmentPlus=1*1*2;
			RushGaugeChange=1;
			PurityRatePlus=0.75*2;
		}
		if(type==2)//ACe@ߐڑłݎɏo
		{
			Scale=1;
			DiScale=0.005;
			R=127;
			G=127;
			B=255;
			PowerPlus=1.5;
			CounterPlus=5;
			CounterPlusOnBurst=5;
			ScorePlus=MagicCounter;
		//	BurstRankPlus=-1;
			RushGaugeChange=2;
		}
		if(type==3)//ԃACe@jɏo
		{
			Scale=2;
			DiScale=0.020;
			R=255;
			G=127;
			B=127;
			PowerPlus=10;
			CounterPlus=20;
			CounterPlusOnBurst=20;
			ScorePlus=20*MagicCounter;
			FragmentPlus=3;
			BurstRankPlus=-20*RushGaugeAdjustRankDown;
			RushGaugeChange=3;
			PurityRatePlus=1.5;
		}
		if(type==4)//ԃACe@ϊɏo
		{
			Alpha=100;
			VAlpha=25;
			Scale=1;
			DiScale=0.010;
			R=255;
			G=127;
			B=127;
			PowerPlus=0.5*DifficultChargeAmp;
			CounterPlus=1.0*DifficultCounterAmp;
			CounterPlusOnBurst=1*DifficultCounterAmp;
			ScorePlus=MagicCounter*DifficultScoreAmp;
			FragmentPlus=1*DifficultFragmentAmp;
			BurstRankPlus=-2.0*RushGaugeAdjustRankDown;
			RushGaugeChange=0.2;
			PurityRatePlus=0.1;
			PNRateChange=0.02;
		}
		if(type==41)//ԃACe@ϊɏo
		{
			Alpha=100;
			VAlpha=25;
			Scale=1.2;
			DiScale=0.012;
			R=255;
			G=127;
			B=127;
			PowerPlus=0.5*DifficultChargeAmp*2;
			CounterPlus=1.0*DifficultCounterAmp*2;
			CounterPlusOnBurst=1*DifficultCounterAmp*2;
			ScorePlus=MagicCounter*DifficultScoreAmp*2;
			FragmentPlus=1*DifficultFragmentAmp*2;
			BurstRankPlus=-2.0*2*RushGaugeAdjustRankDown;
			PurityRatePlus*=2;
			RushGaugeChange=0.2*2;
			PurityRatePlus=0.1*2;
			PNRateChange=0.02*2;
		}

		if(type==42)//ԃACe@ϊɏo
		{
			Alpha=100;
			VAlpha=25;
			Scale=1.5;
			DiScale=0.015;
			R=255;
			G=127;
			B=127;
			PowerPlus=0.5*DifficultChargeAmp*4;
			CounterPlus=1.0*DifficultCounterAmp*4;
			CounterPlusOnBurst=1*DifficultCounterAmp*4;
			ScorePlus=MagicCounter*DifficultScoreAmp*4;
			FragmentPlus=1*DifficultFragmentAmp*4;
			BurstRankPlus=-2.0*4*RushGaugeAdjustRankDown;
			PurityRatePlus*=4;
			RushGaugeChange=0.2*4;
			PurityRatePlus=0.1*4;
			PNRateChange=0.02*4;
		}

		if(type==4.5)//ԃACe@ϊɏo
		{
			Alpha=100;
			VAlpha=25;
			Scale=1*1.5;
			DiScale=0.010*1.5;
			R=255;
			G=127;
			B=127;
			PowerPlus=0.5*DifficultChargeAmp*3;
			CounterPlus=1.0*DifficultCounterAmp*3;
			CounterPlusOnBurst=1*DifficultCounterAmp*3;
			ScorePlus=MagicCounter*DifficultScoreAmp*3;
			FragmentPlus=1*DifficultFragmentAmp*3;
			BurstRankPlus=-2.0*RushGaugeAdjustRankDown*3;
			RushGaugeChange=0.2*3;
			PurityRatePlus=0.1*3;
			PNRateChange=0.02*3;
		}
		if(type==41.5)//ԃACe@ϊɏo
		{
			Alpha=100;
			VAlpha=25;
			Scale=1.2*1.5;
			DiScale=0.012*1.5;
			R=255;
			G=127;
			B=127;
			PowerPlus=0.5*DifficultChargeAmp*2*3;
			CounterPlus=1.0*DifficultCounterAmp*2*3;
			CounterPlusOnBurst=1*DifficultCounterAmp*2*3;
			ScorePlus=MagicCounter*DifficultScoreAmp*2*3;
			FragmentPlus=1*DifficultFragmentAmp*2*3;
			BurstRankPlus=-2.0*2*RushGaugeAdjustRankDown*3;
			RushGaugeChange=0.1*2*3;
			PurityRatePlus=0.1*2*3;
			PNRateChange=0.02*2*3;
		}
		if(type==42.5)//ԃACe@ϊɏo
		{
			Alpha=100;
			VAlpha=25;
			Scale=1.5*1.5;
			DiScale=0.015*1.5;
			R=255;
			G=127;
			B=127;
			PowerPlus=0.5*DifficultChargeAmp*4*3;
			CounterPlus=1.0*DifficultCounterAmp*4*3;
			CounterPlusOnBurst=1*DifficultCounterAmp*4*3;
			ScorePlus=MagicCounter*DifficultScoreAmp*4*3;
			FragmentPlus=1*DifficultFragmentAmp*4*3;
			BurstRankPlus=-2.0*4*RushGaugeAdjustRankDown*3;
			RushGaugeChange=0.1*4*3;
			PurityRatePlus=0.1*4*3;
			PNRateChange=0.02*4*3;
		}

		if(type==5)//唒ACe@jɏo
		{
			Scale=2;
			DiScale=0.020;
			R=255;
			G=255;
			B=255;
			PowerPlus=10*DifficultChargeAmp;
			CounterPlus=10*DifficultCounterAmp;
			CounterPlusOnBurst=10*DifficultCounterAmp;
			ScorePlus=MagicCounter*200*DifficultScoreAmp;
			BurstRankPlus=5*RushGaugeAdjustRankUp;
			FragmentPlus=3;
			RushGaugeChange=10*1.0;
			PurityRatePlus=1.5;
		}
		if(type==6)//ACe1@ϊɏo
		{
			Alpha=100;
			VAlpha=25;
			Scale=1;
			DiScale=0.010;
			R=255;
			G=255;
			B=255;
			PowerPlus=2.5*DifficultChargeAmp;
			CounterPlus=7*DifficultCounterAmp;
			CounterPlusOnBurst=7*DifficultCounterAmp;
			ScorePlus=MagicCounter*10*DifficultScoreAmp;
			FragmentPlus=1*DifficultFragmentAmp;
			BurstRankPlus=0.5*RushGaugeAdjustRankUp;
			RushGaugeChange=1.0;
			PurityRatePlus=0.1;
			PNRateChange=0.1;
		}
		if(type==61)//ACe2@ϊɏo
		{
			Alpha=100;
			VAlpha=25;
			Scale=1.2;
			DiScale=0.012;
			R=255;
			G=255;
			B=255;
			PowerPlus=2.5*DifficultChargeAmp*2;
			CounterPlus=7*DifficultCounterAmp*2;
			CounterPlusOnBurst=7*DifficultCounterAmp*2;
			ScorePlus=MagicCounter*10*DifficultScoreAmp*2;
			FragmentPlus=1*DifficultFragmentAmp*2;
			BurstRankPlus=1*RushGaugeAdjustRankUp;
			RushGaugeChange=1.0*2;
			PurityRatePlus=0.1*2;
			PNRateChange=0.1*2;
		}
		if(type==62)//唒ACe3@ϊɏo
		{
			Alpha=100;
			VAlpha=25;
			Scale=1.5;
			DiScale=0.015;
			R=255;
			G=255;
			B=255;
			PowerPlus=2.5*DifficultChargeAmp*4;
			CounterPlus=7*DifficultCounterAmp*4;
			CounterPlusOnBurst=7*DifficultCounterAmp*4;
			ScorePlus=MagicCounter*10*DifficultScoreAmp*4;
			FragmentPlus=1*DifficultFragmentAmp*4;
			BurstRankPlus=2*RushGaugeAdjustRankUp;
			RushGaugeChange=1.0*4;
			PurityRatePlus=0.1*4;
			PNRateChange=0.1*4;
		}

		if(type==6.5)//ACe1@ϊɏo
		{
			Alpha=100;
			VAlpha=25;
			Scale=1*1.5;
			DiScale=0.010*1.5;
			R=255;
			G=255;
			B=255;
			PowerPlus=2.5*DifficultChargeAmp*3;
			CounterPlus=7*DifficultCounterAmp*3;
			CounterPlusOnBurst=7*DifficultCounterAmp*3;
			ScorePlus=MagicCounter*10*DifficultScoreAmp*3;
			FragmentPlus=1*DifficultFragmentAmp*3;
			BurstRankPlus=0.5*RushGaugeAdjustRankUp*3;
			RushGaugeChange=1.0*3;
			PurityRatePlus=0.1*3;
			PNRateChange=0.1*3;
		}
		if(type==61.5)//ACe2@ϊɏo
		{
			Alpha=100;
			VAlpha=25;
			Scale=1.2*1.5;
			DiScale=0.012*1.5;
			R=255;
			G=255;
			B=255;
			PowerPlus=2.5*DifficultChargeAmp*2*3;
			CounterPlus=7*DifficultCounterAmp*2*3;
			CounterPlusOnBurst=7*DifficultCounterAmp*2*3;
			ScorePlus=MagicCounter*10*DifficultScoreAmp*2*3;
			FragmentPlus=1*DifficultFragmentAmp*2*3;
			BurstRankPlus=1*RushGaugeAdjustRankUp*3;
			RushGaugeChange=1.0*2*3;
			PurityRatePlus=0.1*2*3;
			PNRateChange=0.1*2*3;
		}
		if(type==62.5)//唒ACe3@ϊɏo
		{
			Alpha=100;
			VAlpha=25;
			Scale=1.5*1.5;
			DiScale=0.015*1.5;
			R=255;
			G=255;
			B=255;
			PowerPlus=2.5*DifficultChargeAmp*4*3;
			CounterPlus=7*DifficultCounterAmp*4*3;
			CounterPlusOnBurst=7*DifficultCounterAmp*4*3;
			ScorePlus=MagicCounter*10*DifficultScoreAmp*4*3;
			FragmentPlus=1*DifficultFragmentAmp*4*3;
			BurstRankPlus=2*RushGaugeAdjustRankUp*3;
			RushGaugeChange=1.0*4*3;
			PurityRatePlus=0.1*4*3;
			PNRateChange=0.1*4*3;
		}
/*
		if(type==66)//ϊ唒ACe3
		{
			Alpha=100;
			VAlpha=25;
			Scale=1.75;
			DiScale=0.0175;
			R=255;
			G=255;
			B=255;
			PowerPlus=2.5*DifficultChargeAmp*6;
			CounterPlus=7*DifficultCounterAmp*6;
			CounterPlusOnBurst=7*DifficultCounterAmp*6;
			ScorePlus=MagicCounter*10*DifficultScoreAmp*6;
			FragmentPlus=1*DifficultFragmentAmp*6;
			BurstRankPlus=4*RushGaugeAdjustRankUp;
			RushGaugeChange=4;
		}
*/
		if(type==7)//ACe
		{
			Scale=1;
			DiScale=0.010;
			R=160;
			G=32;
			B=240;
			PowerPlus=1.0*0;
			CounterPlus=10*0;
			CounterPlusOnBurst=0;
			ScorePlus=MagicCounter*0;
			FragmentPlus=1*0;
			RushGaugePlus=-1;
			PNRatePlus-=1;
		}
		if(type==75)//΃ACe
		{
			Scale=1;
			DiScale=0.010;
			R=50;
			G=255;
			B=100;
			PowerPlus=1.0*0;
			CounterPlus=10*0;
			CounterPlusOnBurst=0;
			ScorePlus=MagicCounter*0;
			FragmentPlus=1*0;
			RushGaugePlus=1;
			PNRatePlus+=1;
		}

		if(type==8)//ACe ߐڑłݎ
		{
			Scale=1;
			DiScale=0.010;
			R=255;
			G=255;
			B=255;
			PowerPlus=2.0*DifficultChargeAmp;
			CounterPlus=6*DifficultCounterAmp;
			CounterPlusOnBurst=4*DifficultCounterAmp;
			ScorePlus=MagicCounter*10*DifficultScoreAmp;
			FragmentPlus=1*DifficultFragmentAmp;
			BurstRankPlus=1*RushGaugeAdjustRankUp;
			RushGaugeChange=4;
		}

		if(type==85)//ACe@e
		{
			Scale=1;
			DiScale=0.010;
			R=255;
			G=255;
			B=255;
			PowerPlus=2.0*DifficultChargeAmp;
			CounterPlus=6*DifficultCounterAmp;
			CounterPlusOnBurst=4*DifficultCounterAmp;
			ScorePlus=MagicCounter*10*DifficultScoreAmp;
			FragmentPlus=1*DifficultFragmentAmp;
			BurstRankPlus=1*RushGaugeAdjustRankUp;
			RushGaugeChange=1;
		}

		if(type==85.5)//ACe@e
		{
			Scale=1*2;
			DiScale=0.010*2;
			R=255;
			G=255;
			B=255;
			PowerPlus=2.0*DifficultChargeAmp*10;
			CounterPlus=6*DifficultCounterAmp*10;
			CounterPlusOnBurst=4*DifficultCounterAmp*10;
			ScorePlus=MagicCounter*10*DifficultScoreAmp*10;
			FragmentPlus=1*DifficultFragmentAmp*10;
			BurstRankPlus=1*RushGaugeAdjustRankUp*10;
			RushGaugeChange=1*10;
			PurityRatePlus*=10;
		}

/*
		if(type==9)//ÐACe
		{
			Scale=1;
			DiScale=0.010;
			R=0;
			G=255;
			B=255;
			PowerPlus=1;
			CounterPlus=10;
			CounterPlusOnBurst=10;
			ScorePlus=MagicCounter;
			FragmentPlus=1;
		}
*/
		if(type==10)//ACeߐړGj
		{
			Scale=1.5;
			DiScale=0.015;
			R=255;
			G=255;
			B=255;
			PowerPlus=1;
			CounterPlus=5;
			CounterPlusOnBurst=5;
			ScorePlus=2*10*MagicCounter;
			BurstRankPlus=1*RushGaugeAdjustRankUp;
			FragmentPlus=1*1;
			RushGaugeChange=3;
			PurityRatePlus=0.75;
		}
		if(type==10.5)//ACe
		{
			Scale=2.0;
			DiScale=0.02;
			R=255;
			G=255;
			B=255;
			PowerPlus=1*2;
			CounterPlus=5*2;
			CounterPlusOnBurst=5*2;
			ScorePlus=2*10*MagicCounter*2;
			BurstRankPlus=1*RushGaugeAdjustRankUp*2;
			FragmentPlus=1*1*2;
			RushGaugeChange=3*2;
			PurityRatePlus=0.75*2;
		}
		if(type==101)//{XjACe
		{
			Scale=1;
			DiScale=0.010;
			R=0;
			G=250;
			B=154;
			PowerPlus=108/324*DifficultChargeAmp;
			CounterPlus=1080/324*DifficultCounterAmp;
			CounterPlusOnBurst=1080/324*DifficultCounterAmp;
			ScorePlus=MagicCounter*10*DifficultScoreAmp;
			FragmentPlus=1*DifficultFragmentAmp;

			ScorePlus+=(GetPlayerLife-1)*30000;
			ScorePlus+=(GetPlayerBomb)*10000;
			ScorePlus+=5*SectionMagicFragment;
		}

		if(type==102)//{XjACe
		{
			Scale=1;
			DiScale=0.010;
			R=255;
			G=100;
			B=0;
			PowerPlus=108/324*DifficultChargeAmp;
			CounterPlus=1080/324*DifficultCounterAmp;
			CounterPlusOnBurst=0;
			ScorePlus=MagicCounter*20*DifficultScoreAmp;
			FragmentPlus=2*DifficultFragmentAmp;

			ScorePlus+=(GetPlayerLife-1)*30000*2;
			ScorePlus+=(GetPlayerBomb)*10000*2;
			ScorePlus+=5*SectionMagicFragment*2;
		}

		if(type==103)//{XjACe
		{
			Scale=1;
			DiScale=0.010;
			R=148;
			G=0;
			B=211;
			PowerPlus=108/324*DifficultChargeAmp;
			CounterPlus=1080/324*DifficultCounterAmp;
			CounterPlusOnBurst=0;
			ScorePlus=MagicCounter*30*DifficultScoreAmp;
			FragmentPlus=3*DifficultFragmentAmp;

			ScorePlus+=(GetPlayerLife-1)*30000*3;
			ScorePlus+=(GetPlayerBomb)*10000*3;
			ScorePlus+=5*SectionMagicFragment*3;
		}

		if(type==104)//{XjACe
		{
			Scale=1;
			DiScale=0.010;
			R=0;
			G=100;
			B=255;
			PowerPlus=108/324*DifficultChargeAmp;
			CounterPlus=1080/324*DifficultCounterAmp;
			CounterPlusOnBurst=0;
			ScorePlus=MagicCounter*40*DifficultScoreAmp;
			FragmentPlus=4*DifficultFragmentAmp;

			ScorePlus+=(GetPlayerLife-1)*30000*4;
			ScorePlus+=(GetPlayerBomb)*10000*4;
			ScorePlus+=5*SectionMagicFragment*4;
		}
		if(type==105)//{XjACe
		{
			Scale=1;
			DiScale=0.010;
			R=255;
			G=255;
			B=0;
			PowerPlus=108/324*DifficultChargeAmp;
			CounterPlus=1080/324*DifficultCounterAmp;
			CounterPlusOnBurst=0;
			ScorePlus=MagicCounter*40*DifficultScoreAmp;
			FragmentPlus=5*DifficultFragmentAmp;

			ScorePlus+=(GetPlayerLife-1)*30000*5;
			ScorePlus+=(GetPlayerBomb)*10000*5;
			ScorePlus+=5*SectionMagicFragment*5;
		}
		if(type==106)//{XjACe
		{
			Scale=1;
			DiScale=0.010;
			let Mcolor=MagicHueDifine(rand_int(0,360));
			R=Mcolor[0];
			G=Mcolor[1];
			B=Mcolor[2];
			PowerPlus=108/324*DifficultChargeAmp;
			CounterPlus=1080/324*DifficultCounterAmp;
			CounterPlusOnBurst=0;
			ScorePlus=MagicCounter*40*DifficultScoreAmp;
			FragmentPlus=10*DifficultFragmentAmp;

			ScorePlus+=(GetPlayerLife-1)*30000*10;
			ScorePlus+=(GetPlayerBomb)*10000*10;
			ScorePlus+=5*SectionMagicFragment*10;
		}
		DiScale=0.00;
		Scale*=0.75;
			Alpha=150;
			VAlpha=25;
		if(type<100)
		{
			if(CoolFlag || RashFlag)
			{
				ScorePlus*=2;
			}
		}
		if(type>100)
		{

		}
		else if(type==-1 || type==2 || type==2 || type==8 || type==7 || type==75 || type==9 || type==15 || type==25 || type==45)
		{
			loop(5)
			{
				lightangle+=12;
				ascent(let i in 0..4)
				{
					ObjEffect_SetVertexColor(obj,i,Alpha+VAlpha*cos(lightangle),R,G,B);
				}
				Obj_SetAngle(obj,angle);
				Obj_SetSpeed(obj,speed);
				speed-=StandardSpeed/15;
				Scale-=DiScale*2;
				ObjEffect_SetScale(obj,Scale,Scale);
			AnimeNumCount+=1;
			if(AnimeNumCount%15<=7)
			{
			AnimeNum=trunc(AnimeNumCount%15);
			ObjEffect_SetAngle(obj,0,0,ZAngle);
			}
			else
			{
			AnimeNum=trunc(15-AnimeNumCount%15);
			ObjEffect_SetAngle(obj,0,180,ZAngle);
			}
			ObjEffect_SetVertexUV(obj, 0,  0,  0+80*AnimeNum);
			ObjEffect_SetVertexUV(obj, 1,  104, 0+80*AnimeNum);
			ObjEffect_SetVertexUV(obj, 2, 104,  80+80*AnimeNum);
			ObjEffect_SetVertexUV(obj, 3, 0, 80+80*AnimeNum);

				yield;
			}
		}
		else
		{
			speed=speed*2;
			StandardSpeed=speed;
			loop(15)
			{
				lightangle+=12;
				ascent(let i in 0..4)
				{
					ObjEffect_SetVertexColor(obj,i,Alpha+VAlpha*cos(lightangle),R,G,B);
				}
				Obj_SetAngle(obj,angle);
				Obj_SetSpeed(obj,speed);
				speed-=StandardSpeed/15;
				Scale-=DiScale*2;
				ObjEffect_SetScale(obj,Scale,Scale);
			AnimeNumCount+=1;
			if(AnimeNumCount%15<=7)
			{
			AnimeNum=trunc(AnimeNumCount%15);
			ObjEffect_SetAngle(obj,0,0,ZAngle);
			}
			else
			{
			AnimeNum=trunc(15-AnimeNumCount%15);
			ObjEffect_SetAngle(obj,0,180,ZAngle);
			}
			ObjEffect_SetVertexUV(obj, 0,  0,  0+80*AnimeNum);
			ObjEffect_SetVertexUV(obj, 1,  104, 0+80*AnimeNum);
			ObjEffect_SetVertexUV(obj, 2, 104,  80+80*AnimeNum);
			ObjEffect_SetVertexUV(obj, 3, 0, 80+80*AnimeNum);

	
				yield;
			}
		}

		let AddRushFlag=false;
		if(type==2 || type==5 || type==6 || type==61 || type==62 || type==66 || type==8 || type==85 || type==10)
		{
			if(RashFlag || CoolFlag){}
			else{AddRushFlag=true;}
		}

		while(!Obj_BeDeleted(obj))
		{
		//	Obj_SetPosition(obj,Obj_GetX(obj)+speed*cos(sangle),Obj_GetY(obj)+speed*sin(sangle));
			ZAngle+=ZRotateAngle;
			ObjEffect_SetAngle(obj,0,0,ZAngle);
			Scale-=DiScale;
			ObjEffect_SetScale(obj,Scale,Scale);
			if(speed<30)
			{
			speed+=0.25;
			}
			lightangle+=12;
			ascent(let i in 0..4)
			{
				ObjEffect_SetVertexColor(obj,i,Alpha+VAlpha*cos(lightangle),R,G,B);
			}
			let sangle=atan2(GetPlayerY-Obj_GetY(obj),GetPlayerX-Obj_GetX(obj));
			Obj_SetAngle(obj,sangle);
			Obj_SetSpeed(obj,speed);
			if(((Obj_GetX(obj)-GetPlayerX)^2+(Obj_GetY(obj)-GetPlayerY)^2)^0.5<35)
			{
				if(Power<1000 && BurstMode==0)
				{
					Power+=PowerPlus;
					if(Power>1000){Power=1000;}
				}
				if(MagicCounter<10000 && BurstMode==0)
				{
					MagicCounter+=CounterPlus;
					if(MagicCounter>10000){MagicCounter=10000;}
				}
				if(MagicCounter<10000 && BurstMode==1)
				{
					MagicCounter+=CounterPlusOnBurst;
					if(MagicCounter>10000){MagicCounter=10000;}
				}
				if(PurityRate!=1)
				{
					if(BurstMode==1)
					{
					PurityRateCount+=PurityRatePlus*0.8;
					}
					else
					{
					PurityRateCount+=PurityRatePlus*1.2;
					}
				}
				AddScore(ScorePlus*PurityRate);
				MagicFragment+=FragmentPlus;
				SectionMagicFragment+=FragmentPlus;
				BurstRank+=BurstRankPlus;
				if(BurstRank>10000){BurstRank=10000;}
				if(BurstRank<0){BurstRank=0;}
				if(absolute(RushGauge)!=1000)
				{
				if(RushGaugeChange!=0)
				{
					RushGauge+=RushGaugeChange/4*PNRate/100;
				/*
					if(RushGauge>0)
					{
					RushGauge+=RushGaugeChange/4;
					}
					else if(RushGauge<0)
					{
					RushGauge-=RushGaugeChange/4;
					}
				*/
				}
				RushGauge+=RushGaugePlus;
				if(RushGauge>1000){RushGauge=1000;}
				if(RushGauge<-1000){RushGauge=-1000;}
				}
				PNRate+=PNRatePlus;
				if(PNRateChange!=0)
				{
				if(GetCommonData("SlowMoveSwitch"))
				{
					PNRate-=PNRateChange;
				}
				else
				{
					PNRate+=PNRateChange;
				}
				}
				if(PNRate>100){PNRate=100;}
				if(PNRate<-100){PNRate=-100;}
				PlaySE(SE[7]);

				Obj_Delete(obj);
			}
			AnimeNumCount+=1;
			if(AnimeNumCount%15<=7)
			{
			AnimeNum=trunc(AnimeNumCount%15);
			ObjEffect_SetAngle(obj,0,0,ZAngle);
			}
			else
			{
			AnimeNum=trunc(15-AnimeNumCount%15);
			ObjEffect_SetAngle(obj,0,180,ZAngle);
			}
			ObjEffect_SetVertexUV(obj, 0,  0,  0+80*AnimeNum);
			ObjEffect_SetVertexUV(obj, 1,  104, 0+80*AnimeNum);
			ObjEffect_SetVertexUV(obj, 2, 104,  80+80*AnimeNum);
			ObjEffect_SetVertexUV(obj, 3, 0, 80+80*AnimeNum);

		yield;
		}
}

task Weakness
{
	let WCount=30;
	if(RushGauge>0)
	{
		WCount=30*(1+RushGauge/1000);
	}
	else if(RushGauge<0)
	{
		WCount=30*(1+0.5*RushGauge/1000);
	}
	if(WeaknessCount<WCount)
	{
		WeaknessCount=WCount;
	}
}
